﻿using Microsoft.Reporting.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GEA
{
    public partial class frmrptStocks : Form
    {
        string id_E = "";
        DateTime Data = DateTime.Now;
        public frmrptStocks()
        {
            InitializeComponent();
        }
        public frmrptStocks(string id_e,DateTime data)
        {
            InitializeComponent();
            id_E = id_e;
            if (data.ToShortDateString() == DateTime.Today.ToShortDateString())
                Data = DateTime.Now;
            else
                Data = DateTime.Parse(data.ToShortDateString() + " 23:59:59");

            this.Padding = new System.Windows.Forms.Padding(20, 20, 20, 50);
            
        }
        private void frmrptStocks_Load(object sender, EventArgs e)
        {
            
            // TODO: This line of code loads data into the 'geaDataSet.GetStocksReferencias' table. You can move, or remove it, as needed.
            this.GetStocksReferenciasTableAdapter.Fill(this.geaDataSet.GetStocksReferencias,id_E,Data);

            ReportParameter p1 = new ReportParameter("p1", Data.ToShortDateString());
            this.reportViewer1.ShowParameterPrompts = true;
            this.reportViewer1.LocalReport.SetParameters(p1);

            ReportParameter Ent = new ReportParameter("Ent", id_E);
            this.reportViewer1.ShowParameterPrompts = true;
            this.reportViewer1.LocalReport.SetParameters(Ent);


            reportViewer1.LocalReport.DisplayName = "Saldo_" + id_E + "_"+Data.ToShortDateString();
            this.reportViewer1.RefreshReport();
        }
    }
}
